function validate(form={}, validates=[]) {
    let length = validates.length;

    let errorVerify = function (message) {
        return {
            result: false,
            message: message,
            form: form
        };
    }

    let result = {
        result: true,
        message: "验证通过",
        form: form
    };

    // {field: "title", type: "require", rule: "", error:"请填写【页面标题】"},
    loop: for (let i = 0; i < length; i++) {
        let valid = validates[i];
        let {field="", type="", rule="", error="", else: elses=[], and: ands=[]} = valid;
        let value = form[field];
        // 辅助验证参数
        let aux = "";
        if (type.indexOf("|") != -1) {
            [type, aux] = type.split("|");
        }

        // 当aux=h时，不输入时可以过，输入内容正确可以过，输入内容不正确不能过
        if (aux != "h" || !util.isEmpty(value)) {
            switch (type) {
                case "require":
                    if (util.type(value) == "string") {
                        value = form[field] = value.trim();
                    }
                    if (util.isEmpty(value)) {
                        result = errorVerify(error || `${field}不能为空`);
                    }
                    break;
                case "eq":
                    if (value != rule) {
                        result = errorVerify(error || `${field}内容不为${rule}`);
                    }
                    break;
                case "max":
                    if (value.length > rule) {
                        result = errorVerify(error || `${field}不能超过${rule}个字符`);
                    }
                    break;
                case "min":
                    if (value.length < rule) {
                        result = errorVerify(error || `${field}不能小于${rule}个字符`);
                    }
                    break;
                case "between":
                    let between = rule.split(",");
                    if (value.length < between[0] || value.length > between[1]) {
                        result = errorVerify(error || `${field}只能在${between[0]}到${between[1]}之间`);
                    }
                    break;
                case "regex":
                    if (!util.is(rule, value)) {
                        result = errorVerify(error || `${field}正则验证失败`);
                    }
                    break;
                case "callback":
                    if (!rule(value, form, valid)) {
                        result = errorVerify(error || `${field}自定义验证失败`);
                    }
                    break;
            }
        }

        if (result.result == false) {
            if (!util.isEmpty(elses)) {
                if (elses === true) {
                    result = {
                        result: true,
                        message: "验证通过",
                        form: form
                    };
                } else {
                    result = validate(form, elses);
                }
                
                if (!result.result) {
                    break loop;
                }
            } else {
                break loop;
            }
        } else {
            if (!util.isEmpty(ands)) {
                result = validate(form, ands);
                
                if (!result.result) {
                    break loop;
                }
            }
        }
    }

    return result;
}